home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
tex-k
/
eplain-2.6.tar.gz
/
eplain-2.6.tar
/
eplain-2.6
/
doc
/
eplain.info-2
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-05-02
|
49KB
|
921 lines
This is Info file eplain.info, produced by Makeinfo-1.55 from the input
file eplain.texi.
This file documents the Eplain macros.
Copyright (C) 1989, 90, 91, 92, 93, 94 Karl Berry. Steven Smith
wrote the documentation for the commutative diagram macros. (He also
wrote the macros.)
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
section entitled "GNU General Public License" is included exactly as in
the original, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the section entitled "GNU General Public License"
may be included in a translation approved by the author instead of in
the original English.
File: eplain.info, Node: Indexing, Next: Justification, Prev: Page references, Up: User definitions
Indexing
========
Eplain provides support for generating raw material for an index, and
for typesetting a sorted index. A separate program must do the actual
collection and sorting of terms, because TeX itself has no support for
sorting.
Eplain's indexing commands were designed to work with the program
MakeIndex, available from `ftp.math.utah.edu' in the directory
`pub/tex/makeindex', and from CTAN hosts in
`tex-archive/indexing/makeindex'; MakeIndex is also commonly included
in prepackaged TeX distributions. It is beyond the scope of this
manual to explain how to run MakeIndex, and all of its many options.
*Note MAKEINDEX: (makeindex)MAKEINDEX.
The basic strategy for indexing works like this:
1. For a document `foo.tex', Eplain's indexing commands (e.g.,
`\idx'; see the section `Indexing terms' below) write the raw index
material to `foo.idx'.
2. MakeIndex reads `foo.idx', collects and sorts the index, and
writes the result to `foo.ind'.
3. Eplain reads and typesets `foo.ind' on a subsequent run of TeX.
See the section `Typesetting an index' below.
If your document needs more than one index, each must have its own
file. Therefore, Eplain provides the command `\defineindex', which
takes an argument that is a single letter, which replaces `i' in the
filenames and in the indexing command names described below. For
example,
\defineindex{m}
defines the command `\mdx' to write to the file `foo.mdx'. Eplain
simply does `\defineindex{i}' to define the default commands.
* Menu:
* Indexing terms:: Specifying what to index.
* Typesetting an index:: Printing the sorted output.
* Customizing indexing:: Creating commands and specifying extra actions.
File: eplain.info, Node: Indexing terms, Next: Typesetting an index, Up: Indexing
Indexing terms
--------------
Indexing commands in Eplain come in pairs: one command that only
writes the index entry to the `.idx' file (see above section), and one
that also typesets the term being indexed. The former always starts
with `s' (for "silent"). In either case, the name always includes
`Idx', where I is the index letter, also described above. Eplain
defines the index `i' itself, so that's what we'll use in the names
below.
The silent form of the commands take a subterm as a trailing optional
argument. For example, `\sidx{truth}[definition of]' on page 75 makes
an index entry that will eventually be typeset (by default) as
truth
definition of, 75
Also, the silent commands ignore trailing spaces. The non-silent ones
do not.
* Menu:
* Indexing commands:: Making index entries.
* Modifying index entries:: Ranges, see/see also, page number typesetting.
* Proofing index terms:: Noting index entries in the margins.
File: eplain.info, Node: Indexing commands, Next: Modifying index entries, Up: Indexing terms
Indexing commands
.................
Here are the commands.
* `\sidx{TERM}[SUBTERM]' makes an index entry for TERM, optionally
with subterm SUBTERM. `\idx{TERM}' also produces TERM as output.
Example:
\sidx{truth}[beauty of]
The beauty of truth is \idx{death}.
* \sidxname{FIRST M.}{VON LAST}[SUBTERM] makes an index entry for
`VON LAST, FIRST M.'. You can change the `, ' by redefining
`\idxnameseparator'. \idxname{FIRST M.}{VON LAST} also produces
FIRST M. VON LAST as output. (These commands are useful special
cases of `\idx' and `\sidx'.) Example:
\sidxname{Richard}{Stark}
\idxname{Donald}{Westlake} has written many kinds of novels, under
almost as many names.
* `\sidxmarked\CS{TERM}[SUBTERM]' makes an index entry for
`TERM[SUBTERM]', but TERM will be put in the index as `\CS{term}',
but still sorted as just TERM. `\idxmarked\CS{TERM}' also typesets
`\CS{term}'. This provides for the usual ways of changing the
typesetting of index entries. Example:
\def\article#1{``#1''}
\sidxmarked\article{Miss Elsa and Aunt Sophie}
Peter Drucker's \idxmarked\article{The Polanyis} is a remarkable essay
about a remarkable family.
* `\sidxsubmarked{TERM}\CS{subterm}' makes an index entry for TERM,
SUBTERM as usual, but also puts SUBTERM in the index as
`\CS{term}'. `\idxsubmarked{TERM}\CS{subterm}' also typesets
`TERM \CS{subterm}', in the unlikely event that your syntax is
convoluted enough to make this useful. Example:
\def\title#1{{\sl #1}}
\sidxsubmarked{Anderson, Laurie}\title{Strange Angels}
The \idxsubmarked{Anderson}\title{Carmen} is a strange twist.
The commands above rely on MakeIndex's feature for separating sorting
of an index entry's from its typesetting. You can use this directly by
specifying an index entry as `SORT@TYPESET'. For example:
\sidx{Ap-weight@$A_\pi$-weight}
will sort as `Ap-weight', but print with the proper math. The `@' here
is MakeIndex's default character for this purpose. *Note Style
File-MakeIndex: (makeindex)Style File-MakeIndex. To make an index entry
with an `@' in it, you have to escape it with a backslash; Eplain
provides no macros for doing this.
After any index command, Eplain runs `\hookaction{afterindexterm}'.
Because the index commands always add a whatsit item to the current
list, you may wish to preserve a penalty or space past the new item.
For example, given a conditional `\if@aftersctnhead' set true when
you're at a section heading, you could do:
\hookaction{afterindexterm}{\if@aftersctnhead \nobreak \fi}
File: eplain.info, Node: Modifying index entries, Next: Proofing index terms, Prev: Indexing commands, Up: Indexing terms
Modifying index entries
.......................
All the index commands described in the previous section take an
initial optional argument before the index term, which modify the index
entry's meaning in various ways. You can specify only one of the
following in any given command.
These work via MakeIndex's "encapsulation" feature. *Note Customizing
indexing::, if you're not using the default characters for the
MakeIndex operators. The other optional argument (specifying a subterm)
is independent of these.
Here are the possibilities:
`begin'
`end'
These mark an index entry as the beginning or end of a range. The
index entries must match exactly for MakeIndex to recognize them.
Example:
\sidx[begin]{future}[Cohen, Leonard]
...
\sidx[end]{future}[Cohen, Leonard]
will typeset as something like
future,
Cohen, Leonard, 65--94
`see'
This marks an index entry as pointing to another; the real index
term is an additional (non-optional) argument to the command. Thus
you can anticipate a term readers may wish to look up, yet which
you have decided not to index. Example:
\sidx[see]{analysis}[archetypal]{archetypal criticism}
becomes
analysis,
archetypal, See archetypal criticism
`seealso'
Similar to `see' (the previous item), but also allows for normal
index entries of the referencing term. Example:
\sidx[seealso]{archetypal criticism}[elements of]{dichotomies}
becomes
archetypal criticism,
elements of, 75, 97, 114, See also dichotomies
(Aside for the academically curious: The archetypally critical
book I took these dichotomous examples from is Laurence Berman's
`The Musical Image', which I happened to co-design and typeset.)
`pagemarkup=CS'
This puts `\CS' before the page number in the typeset index, thus
allowing you to underline definitive entries, italicize examples,
and the like. You do *not* precede the control sequence CS with a
backslash. (That just leads to expansive difficulties.) Naturally
it is up to you to define the control sequences you want to use.
Example:
\def\defn#1{{\sl #1}}
\sidx[pagemarkeup=defn]{indexing}
becomes something like
indexing, `\defn{75}'
File: eplain.info, Node: Proofing index terms, Prev: Modifying index entries, Up: Indexing terms
Proofing index terms
....................
As you are reading through a manuscript, it is helpful to see what
terms have been indexed, so you can add others, catch miscellaneous
errors, etc. (Speaking from bitter experience, I can say it is extremely
error-prone to leave all indexing to the end of the writing, since it
involves adding many TeX commands to the source files.)
So Eplain puts index terms in the margin of each page, if you set
`\indexproofingtrue'. It is `false' by default. The terms are typeset
by the macro `\indexproofterm', which takes a single argument, the term
to be typeset. Eplain's definition of `\indexproofterm' just puts it
into an `\hbox', first doing `\indexprooffont', which Eplain defines to
select the font `cmtt8'. With this definition long terms run off the
page, but since this is just for proofreading anyway, it seems
acceptable.
On the other hand, we certainly don't want the index term to run into
the text of the page, so Eplain uses the right-hand side of the page
rather than the left-hand page (assuming a language read left to right
here). So `\ifodd\pageno', Eplain kerns by `\outsidemargin', otherwise
by `\insidemargin'. If those macros are undefined, `\indexsetmargins'
defines them to be one inch plus `\hoffset'.
To get the proofing index entries on the proper page, Eplain defines
a new insertion class `\@indexproof'. To unbox any index proofing
material, Eplain redefines `\makeheadline' to call `\indexproofunbox'
before the original `\makeheadline'. Thus, if you have your own output
routine, that redefines or doesn't use `\makeheadline', it's up to you
to call `\indexproofunbox' at the appropriate time.
File: eplain.info, Node: Typesetting an index, Next: Customizing indexing, Prev: Indexing terms, Up: Indexing
Typesetting an index
--------------------
The command `\readindexfile{i}' reads and typesets the `.ind' file
that MakeIndex outputs (from the `.idx' file which the indexing
commands in the previous sections write). Eplain defines a number of
commands that support the default MakeIndex output.
More precisely, `\readindexfile' reads
`\indexfilebasename.INDEX-LETTERnd', where the INDEX-LETTER is the
argument. `\indexfilebasename' is `\jobname' by default, but if you
have different indexes in different parts of a book, you may wish to
change it, just as with bibliographies (*note Citations::.).
MakeIndex was designed to work with LaTeX; therefore, by default the
`.ind' file starts with `\begin{theindex}' and ends with
`\end{theindex}'. If no `\begin' has been defined, Eplain defines one
to ignore its argument and set up for typesetting the index (see
below), and also defines a `\end' to ignore its argument. (In a group,
naturally, since there is a primitive `\end').
Eplain calls `\indexfonts', sets `\parindent = 0pt', and does
`\doublecolumns' (*note Multiple columns::.) at the `\begin{theindex}'.
`\indexfonts' does nothing by default; it's just there for you to
override. (Indexes are usually typeset in smaller type than the main
text.)
It ends the setup with `\hookrun{beginindex}', so you can override
anything you like in that hook (*note Hooks::.). For example:
\hookaction{beginindex}{\triplecolumns}
MakeIndex turns each main index entry into an `\item', subentries
into `\subitem', and subsubentries into `\subsubitem'. By default, the
first line of main entries are not indented, and subentries are
indented 1em per level. Main entries are preceded by a `\vskip' of
`\aboveitemskipamount', `0pt plus2pt' by default. Page breaks are
encouraged before main entries (`\penalty -100'), but prohibited
afterwards--Eplain has no provision for "continued" index entries.
All levels do the following:
\hangindent = 1em
\raggedright
\hyphenpenalty = 10000
Each entry ends with `\hookrun{indexitem}', so you can change any of
this. For example, to increase the allowable rag:
\hookaction{indexitem}{\advance\rightskip by 2em}
Finally, MakeIndex outputs `\indexspace' between each group of
entries in the `.ind' file. Eplain makes this equivalent to `\bigbreak'.
File: eplain.info, Node: Customizing indexing, Prev: Typesetting an index, Up: Indexing
Customizing indexing
--------------------
By default, MakeIndex outputs `, ' after each term in the index. To
change this, you can add the following to your MakeIndex style (`.ist')
file:
delim_0 "\\afterindexterm "
delim_1 "\\afterindexterm "
delim_2 "\\afterindexterm "
Eplain makes `\afterindexterm' equivalent to `\quad'.
You can also change the keywords Eplain recognizes (*note Modifying
index entries::.):
`\idxbeginrangeword'
`begin'
`\idxendrangeword'
`end
`\idxseeword'
`see
`\idxseealsoword'
`seealso'
You can also change the magic characters Eplain puts into the `.idx'
file, in case you've changed them in the `.ist' file:
`\idxsubentryseparator'
`!'
`\idxencapoperator'
`|'
`\idxbeginrangemark'
`('
`\idxendrangemark'
`)'
There is no macro for the `actual' (`@' by default) character,
because it's impossible to make it expand properly.
Finally, you can change the (imaginary) page number that "see also"
entries sort as by redefining `\idxmaxpagenum'. This is 99999 by
default, which is one digit too many for old versions of MakeIndex.
File: eplain.info, Node: Justification, Next: Tables, Prev: Indexing, Up: User definitions
Justification
=============
Eplain defines three commands to conveniently justify multiple lines
of text: `\flushright', `\flushleft', and `\center'.
They all work in the same way; let's take `\center' as the example.
To start centering lines, you say `\center' inside a group; to stop,
you end the group. Between the two commands, each end-of-line in the
input file also starts a new line in the output file.
The entire block of text is broken into paragraphs at blank lines, so
all the TeX paragraph-shaping parameters apply in the usual way. This
is convenient, but it implies something else that isn't so convenient:
changes to any linespacing parameters, such as `\baselineskip', will
have *no effect* on the paragraph in which they are changed. TeX does
not handle linespacing changes within a paragraph (because it doesn't
know where the line breaks are until the end of the paragraph).
The space between paragraphs is by default one blank line's worth.
You can adjust this space by assigning to `\blanklineskipamount'; this
(vertical) glue is inserted after each blank line.
Here is an example:
{\center First line.
Second line, with a blank line before.
}
This produces:
First line.
Second line, with a blank line before.
You may wish to use the justification macros inside of your own
macros. Just be sure to put them in a group. For example, here is how
a title macro might be defined:
\def\title{\begingroup\titlefont\center}
\def\endtitle{\endgroup}
File: eplain.info, Node: Tables, Next: Margins, Prev: Justification, Up: User definitions
Tables
======
Eplain provides a single command, `\makecolumns', to make generating
one particular kind of table easier. More ambitious macro packages
might be helpful to you for more difficult applications. The files
`ruled.tex' and `TXSruled.tex', available from `lifshitz.ph.utexas.edu'
in `texis/tables', is the only one I know of.
Many tables are homogenous, i.e., all the entries are semantically the
same. The arrangement into columns is to save space on the page, not
to encode different meanings. In this kind of the table, it is useful
to have the column breaks chosen automatically, so that you can add or
delete entries without worrying about the column breaks.
`\makecolumns' takes two arguments: the number of entries in the
table, and the number of columns to break them into. As you can see
from the example below, the first argument is delimited by a slash, and
the second by a colon and a space (or end-of-line). The entries for the
table then follow, one per line (not including the line with the
`\makecolumns' command itself).
`\parindent' defines the space to the left of the table. `\hsize'
defines the width of the table. So you can adjust the position of the
table on the page by assignments to these parameters, probably inside a
group.
You can also control the penalty at a page break before the
`\makecolumns' by setting the parameter `\abovecolumnspenalty'.
Usually, the table is preceded by some explanatory text. You wouldn't
want a page break to occur after the text and before the table, so
Eplain sets it to `10000'. But if the table produced by `\makecolumns'
is standing on its own, `\abovecolumnspenalty' should be decreased.
If you happen to give `\makecolumns' a smaller number of entries than
you really have, some text beyond the (intended) end of the table will
be incorporated into the table, probably producing an error message, or
at least some strange looking entries. And if you give `\makecolumns'
a larger number of entries than you really have, some of the entries
will be typeset as straight text, probably also looking somewhat out of
place.
Here is an example:
% Arrange 6 entries into 2 columns:
\makecolumns 6/2: % This line doesn't have an entry.
one
two
three
four
five
six
Text after the table.
This produces `one', `two', and `three' in the first column, and
`four', `five', and `six' in the second.
File: eplain.info, Node: Margins, Next: Multiple columns, Prev: Tables, Up: User definitions
Margins
=======
TeX's primitives describe the type area in terms of an offset from
the upper left corner, and the width and height of the type. Some
people prefer to think in terms of the "margins" at the top, bottom,
left, and right of the page, and most composition systems other than
TeX conceive of the page laid out in this way. Therefore, Eplain
provides commands to directly assign and increment the margins.
`\topmargin = DIMEN'
`\bottommargin = DIMEN'
`\leftmargin = DIMEN'
`\rightmargin = DIMEN'
These commands set the specified margin to the DIMEN given. The
`=' and the spaces around it are optional. The control sequences
here are not TeX registers, despite appearances; therefore,
commands like `\showthe\topmargin' will not do what you expect.
`\advancetopmargin by DIMEN'
`\advancebottommargin by DIMEN'
`\advanceleftmargin by DIMEN'
`\advancerightmargin by DIMEN'
These commands change the specified margin by the DIMEN given.
Regardless of whether you use the assignment or the advance commands,
Eplain always changes the type area in response, not the other margins.
For example, when TeX starts, the left and right margins are both one
inch. If you then say `\leftmargin = 2in', the right margin will
remain at one inch, and the width of the lines (i.e., `\hsize') will
decrease by one inch.
When you use any of these commands, Eplain computes the old value of
the particular margin, by how much you want to change it, and then
resets the values of TeX's primitive parameters to correspond.
Unfortunately, Eplain cannot compute the right or bottom margin without
help: you must tell it the full width and height of the final output
page. It defines two new parameters for this:
`\paperheight'
The height of the output page; default is 11in.
`\paperwidth'
The width of the output page; default is 8.5in.
If your output page has different dimensions than this, you must
reassign to these parameters, as in
\paperheight = 11in
\paperwidth = 17in
File: eplain.info, Node: Multiple columns, Next: Footnotes, Prev: Margins, Up: User definitions
Multiple columns
================
Eplain provides for double, triple, and quadruple column output: say
`\doublecolumns', `\triplecolumns', or `\quadcolumns', and from that
point on, the manuscript will be set in columns. To go back to one
column, say `\singlecolumn'.
You may need to invoke `\singlecolumn' to balance the columns on the
last page of output.
To do a "column eject", i.e., move to the top of the next column, do
`\columnfill'. This does not actually force an eject, however: it
merely inserts a kern of size `\@normalvsize' minus `\pagetotal'
(`\@normalvsize' being the usual height of the page; to implement
multicolumns, Eplain multiplies `\vsize' itself by the number of
columns). In most circumstances, a column break will be forced after
this kern (during the column splitting operation when the whole page is
output), as desired.
The columns are separated by the value of the dimen parameter
`\gutter'. Default value is two picas.
All the `\...columns' macros insert the value of the glue parameter
`\abovedoublecolumnskip' before the multicolumn text, and the value of
the glue parameter `\belowdoublecolumnskip' after it. The default
value for both of these parameters is `\bigskipamount', i.e., one
linespace in plain TeX.
The macros take into account only the insertion classes defined by
plain TeX; namely, footnotes and `\topinsert's. If you have additional
insertion classes, you will need to change the implementation.
Also, Eplain makes insertions the full page width. There is no
provision for column-width insertions.
File: eplain.info, Node: Footnotes, Next: Fractions, Prev: Multiple columns, Up: User definitions
Footnotes
=========
The most common reference mark for footnotes is a raised number,
incremented on each footnote. The `\numberedfootnote' macro provides
this. It takes one argument, the footnote text.
If your document uses only numbered footnotes, you could make typing
`\numberedfootnote' more convenient with a command such as:
\let\footnote = \numberedfootnote
After doing this, you can type your footnotes as `\footnote{FOOTNOTE
TEXT}', instead of as `\numberedfootnote{FOOTNOTE TEXT}'.
Eplain keeps the current footnote number in the count register
`\footnotenumber'. So, to reset the footnote number to zero, as you
might want to do at, for example, the beginning of a chapter, you could
say `\footnotenumber=0'.
Plain TeX separates the footnote marker from the footnote text by an
en space (it uses the `\textindent' macro). In Eplain, you can change
this space by setting the dimension register `\footnotemarkseparation'.
The default is still an en.
You can produce a space between footenotes by setting the glue
register `\interfootnoteskip'. The default is zero.
`\parskip' is also set to zero by default before the beginning of
each footnote (but not for the text of the footnote).
You can also control footnote formatting in a more general way:
Eplain expands the token register `\everyfootnote' before a footnote is
typeset, but after the default values for all the parameters have been
established. For example, if you want your footnotes to be printed in
seven-point type, indented by one inch, you could say:
\everyfootnote = {\sevenrm \leftskip = 1in}
By default, an `\hrule' is typeset above each group of footnotes on a
page. You can control the dimensions of this rule by setting the
dimension registers `\footnoterulewidth' and `\footnoteruleheight'.
The space between the rule and the first footnote on the page is
determined by the dimension register `\belowfootnoterulespace'. If you
don't want any rule at all, set `\footenoteruleheight=0pt', and, most
likely, `\belowfootnoterulespace=0pt'. The defaults for these
parameters typeset the rule in the same way as plain TeX: the rule is
0.4 points high, 2 true inches wide, with 2.6 points below it.
The space above the rule and below the text on the page is controlled
by the glue register `\skip\footins'. The default is a plain TeX
`\bigskip'.
File: eplain.info, Node: Fractions, Next: Paths, Prev: Footnotes, Up: User definitions
Fractions
=========
Exercise 11.6 of `The TeXbook' describes a macro `\frac' for setting
fractions, but `\frac' never made it into plain TeX. So Eplain
includes it.
`\frac' typesets the numerator and denominator in `\scriptfont0',
slightly raised and lowered. The numerator and denominator are
separated by a slash. The denominator must be enclosed in braces if
it's more than one token long, but the numerator need not be. (This is
a consequence of `\frac' taking delimited arguments; see page 203 of
`The TeXbook' for an explanation of delimited macro arguments.)
For example, `\frac 23/{64}' turns `23/64' into 23/64 (you can't see
the difference in the Info file).
File: eplain.info, Node: Paths, Next: Logos, Prev: Fractions, Up: User definitions
Paths
=====
When you typeset long pathnames, electronic mail addresses, or other
such "computer" names, you would like TeX to break lines at punctuation
characters within the name, rather than trying to find hyphenation
points within the words. For example, it would be better to break the
email address `letters@alpha.gnu.ai.mit.edu' at the `@' or a `.',
rather than at the hyphenation points in `letters' and `alpha'.
If you use the `\path' macro to typeset the names, TeX will find
these good breakpoints. The argument to `\path' is delimited by any
other other than `\' which does not appear in the name itself. `|' is
often a good choice, as in:
\path|letters@alpha.gnu.ai.mit.edu|
You can control the exact set of characters at which breakpoints will
be allowed by calling `\discretionaries'. This takes the same sort of
delimited argument; any character in the argument will henceforth be a
valid breakpoint within `\path'. The default set is essentially all the
punctuation characters:
\discretionaries |~!@$%^&*()_+`-=#{}[]:";'<>,.?\/|
If for some reason you absolutely must use `\' as the delimiter
character for `\path', you can set `\specialpathdelimiterstrue'.
(Other delimiter characters can still be used.) TeX then processes the
`\path' argument about four times more slowly.
File: eplain.info, Node: Logos, Next: Boxes, Prev: Paths, Up: User definitions
Logos
=====
Eplain redefines the `\TeX' macro of plain TeX to end with `\null',
so that the proper spacing is produced when `\TeX' is used at the end
of a sentence. The other ...TeX macros listed here do this, also.
Eplain defines `\AMSTeX', `\BibTeX' `\AMSLaTeX', `\LAMSTeX', `\LaTeX'
`\MF', and `\SLiTeX' to produce their respective logos. (Sorry, the
logos are not shown here.) Some spelling variants of these are also
supported.
File: eplain.info, Node: Boxes, Prev: Logos, Up: User definitions
Boxes
=====
The solid rectangle that Eplain uses as a marker in unordered lists
(*note Lists::.) is available by itself: just say `\blackbox'.
You can create black boxes of arbitrary size with `\hrule' or
`\vrule'.
You can also get unfilled rectangles with `\makeblankbox'. This
takes two explicit arguments: the height and depth of the rules that
define the top and bottom of the rectangle. (The two arguments are
added to get the width of the left and right borders, so that the
thickness of the border is the same on all four sides.) It also uses,
as implicit arguments, the dimensions of `\box0' to define the
dimensions of the rectangle it produces. (The contents of `\box0' are
ignored.)
Here is an example. This small raised open box is suitable for
putting next to numbers in, e.g., a table of contents.
\def\openbox{%
\ht0 = 1.75pt \dp0 = 1.75pt \wd0 = 3.5pt
\raise 2.75pt \makeblankbox{.2pt}{.2pt}
}
Finally, you can put a box around arbitrary text with `\boxit'. This
takes one argument, which must itself be a (TeX) box, and puts a
printed box around it, separated by `\boxitspace' white space (3 points
by default) on all four sides. For example:
\boxit{\hbox{This text is boxed.}}
The reason that the argument must be a box is that when the text is
more than one line long, TeX cannot figure out the line length for
itself. Eplain does set `\parindent' to zero inside `\boxit', since it
is very unlikely you would want indentation there. (If you do, you can
always reset it yourself.)
`\boxit' uses `\ehrule' and `\evrule' so that you can easily adjust
the thicknesses of the box rules. *Note Rules::.
File: eplain.info, Node: Arrow theoretic diagrams, Next: Programming definitions, Prev: User definitions, Up: Top
Arrow theoretic diagrams
************************
This chapter describes definitions for producing commutative diagrams.
Steven Smith wrote this documentation (and the macros).
* Menu:
* Slanted lines and vectors::
* Commutative diagrams::
File: eplain.info, Node: Slanted lines and vectors, Next: Commutative diagrams, Up: Arrow theoretic diagrams
Slanted lines and vectors
=========================
The macros `\drawline' and `\drawvector' provide the capability found
in LaTeX's picture mode to draw slanted lines and vectors of certain
directions. Both of these macros take three arguments: two integer
arguments to specify the direction of the line or vector, and one
argument to specify its length. For example, `\drawvector(-4,1){60pt}'
produces the vector
(A vector in the 2d quadrant of length 60 pt appears here.)
which lies in the 2d quadrant, has a slope of minus 1/4, and a width
of 60 pt.
Note that if an `\hbox' is placed around `\drawline' or
`\drawvector', then the width of the `\hbox' will be the positive
dimension specified in the third argument, except when a vertical line
or vector is specified, e.g., `\drawline(0,1){1in}', which has zero
width. If the specified direction lies in the 1st or 2d quadrant
(e.g., `(1,1)' or `(-2,3)'), then the `\hbox' will have positive height
and zero depth. Conversely, if the specified direction lies in the 3d
or 4th quadrant (e.g., `(-1,-1)' or `(2,-3)'), then the `\hbox' will
have positive depth and zero height.
There are a finite number of directions that can be specified. For
`\drawline', the absolute value of each integer defining the direction
must be less than or equal to six, i.e., `(7,-1)' is incorrect, but
`(6,-1)' is acceptable. For `\drawvector', the absolute value of each
integer must be less than or equal to four. Furthermore, the two
integers cannot have common divisors; therefore, if a line with slope 2
is desired, say `(2,1)' instead of `(4,2)'. Also, specify `(1,0)'
instead of, say, `(3,0)' for horizontal lines and likewise for vertical
lines.
Finally, these macros depend upon the LaTeX font `line10'. If your
site doesn't have this font, ask your system administrator to get it.
Future enhancements will include macros to draw dotted lines and dotted
vectors of various directions.
File: eplain.info, Node: Commutative diagrams, Prev: Slanted lines and vectors, Up: Arrow theoretic diagrams
Commutative diagrams
====================
The primitive commands `\drawline' and `\drawvector' can be used to
typeset arrow theoretic diagrams. This section describes (1) macros to
facilitate typesetting arrows and morphisms, and (2) macros to
facilitate the construction of commutative diagrams. All macros
described in this section must be used in math mode.
* Menu:
* Arrows and morphisms::
* Construction of commutative diagrams::
* Commutative diagram parameters::
File: eplain.info, Node: Arrows and morphisms, Next: Construction of commutative diagrams, Up: Commutative diagrams
Arrows and morphisms
--------------------
The macros `\mapright' and `\mapleft' produce right and left pointing
arrows, respectively. Use superscript (`^') to place a morphism above
the arrow, e.g., `\mapright^\alpha'; use subscript (`_') to place a
morphism below the arrow, e.g., `\mapright_{\tilde l}'. Superscripts
and subscripts may be used simulataneously, e.g., `\mapright^\pi_{\rm
epimor.}'.
Similarly, the macros `\mapup' and `\mapdown' produce up and down
pointing arrows, respectively. Use `\rt' to place a morphism to the
right of the arrow, e.g., `\mapup\rt{\rm id}'; use `\lft' to place a
morphism to the left of the arrow, e.g., `\mapup\lft\omega'. `\lft'
and `\rt' may be used simultaneously, e.g., `\mapdown\lft\pi\rt{\rm
monomor.}'.
Slanted arrows are produced by the macro `\arrow', which takes a
direction argument (e.g., `\arrow(3,-4)'). Use `\rt' and `\lft' to
place morphisms to the right and left, respectively, of the arrow. A
slanted line (no arrowhead) is produced with the macro `\sline', whose
syntax is identical to that of `\arrow'.
The length of these macros is predefined by the default TeX
dimensions `\harrowlength', for horizontal arrows (or lines),
`\varrowlength', for vertical arrows (or lines), and `\sarrowlength',
for slanted arrows (or lines). To change any of these dimensions, say,
e.g., `\harrowlength=40pt'. As with all other TeX dimensions, the
change may be as global or as local as you like. Furthermore, the
placement of morphisms on the arrows is controlled by the dimensions
`\hmorphposn', `\vmorphposn', and `\morphdist'. The first two
dimensions control the horizontal and vertical position of the morphism
from its default position; the latter dimension controls the distance
of the morphism from the arrow. If you have more than one morphism per
arrow (i.e., a `^'/`_' or `\lft'/`\rt' construction), use the parameters
`\hmorphposnup', `\hmorphposndn', `\vmorphposnup', `\vmorphposndn',
`\hmorphposnrt', `\hmorphposnlft', `\vmorphposnrt', and
`\vmorphposnlft'. The default values of all these dimensions are
provided in the section on parameters that follows below.
There is a family of macros to produce horizontal lines, arrows, and
adjoint arrows. The following macros produce horizontal maps and have
the same syntax as `\mapright':
`\mapright'
`$X\mapright Y$' = (a right arrow).
`\mapleft'
`$X\mapleft Y$' = (a left arrow).
`\hline'
`$X\hline Y$' = (horizontal line)
`\bimapright'
`$X\bimapright Y$' = (two right arrows).
`\bimapleft'
`$X\bimapleft Y$' = (two left arrows)
`\adjmapright'
`$X\adjmapright Y$' = (two adjoint arrows; left over right)
`\adjmapleft'
`$X\adjmapleft Y$' = (two adjoint arrows; right over left)
`\bihline'
`$X\bihline Y$' = (two horizontal lines)
There is also a family of macros to produce vertical lines, arrows,
and adjoint arrows. The following macros produce vertical maps and have
the same syntax as `\mapdown':
`\mapdown'
(a down arrow)
`\mapup'
(an up arrow)
`\vline'
(vertical line)
`\bimapdown'
(two down arrows)
`\bimapup'
(two up arrows)
`\adjmapdown'
(two adjoint arrows; down then up)
`\adjmapup'
(two adjoint arrows; up then down)
`\bivline'
(two vertical lines)
Finally, there is a family of macros to produce slanted lines, arrows,
and adjoint arrows. The following macros produce slanted maps and have
the same syntax as `\arrow':
`\arrow'
(a slanted arrow)
`\sline'
(a slanted line)
`\biarrow'
(two straight arrows)
`\adjarrow'
(two adjoint arrows)
`\bisline'
(two straight lines)
The width between double arrows is controlled by the parameter
`\channelwidth'. The parameters `\hchannel' and `\vchannel', if
nonzero, override `\channelwidth' by controlling the horizontal and
vertical shifting from the first arrow to the second.
There are no adornments on these arrows to distinguish inclusions from
epimorphisms from monomorphisms. Many texts, such as Lang's book
`Algebra', use as a tasteful alternative the symbol `inc' (in roman)
next to an arrow to denote inclusion.
Future enhancements will include a mechanism to draw curved arrows
found in, e.g., the Snake Lemma, by employing a version of the `\path'
macros of Appendix D of `The TeXbook'.
File: eplain.info, Node: Construction of commutative diagrams, Next: Commutative diagram parameters, Prev: Arrows and morphisms, Up: Commutative diagrams
Construction of commutative diagrams
------------------------------------
There are two approaches to the construction of commutative diagrams
described here. The first approach, and the simplest, treats
commutative diagrams like fancy matrices, as Knuth does in Exercise
18.46 of `The TeXbook'. This case is covered by the macro `\commdiag',
which is an altered version of the Plain TeX macro `\matrix'. An
example suffices to demonstrate this macro. The following commutative
diagram (illustrating the covering homotopy property; Bott and Tu,
`Differential Forms in Algebraic Topology')
(A commutative diagram appears here in the printed output.)
is produced with the code
$$\commdiag{Y&\mapright^f&E\cr \mapdown&\arrow(3,2)\lft{f_t}&\mapdown\cr
Y\times I&\mapright^{\bar f_t}&X}$$
Of course, the parameters may be changed to produce a different
effect. The following commutative diagram (illustrating the universal
mapping property; Warner, `Foundations of Differentiable Manifolds and
Lie Groups')
(A commutative diagram appears here in the printed output.)
is produced with the code
$$\varrowlength=20pt
\commdiag{V\otimes W\cr \mapup\lft\phi&\arrow(3,-1)\rt{\tilde l}\cr
V\times W&\mapright^l&U\cr}$$
A diagram containing isosceles triangles is achieved by placing the
apex of the triangle in the center column, as shown in the example
(illustrating all constant minimal realizations of a linear system;
Brockett, `Finite Dimensional Linear Systems')
(A commutative diagram appears here in the printed output.)
which is produced with the code
$$\sarrowlength=.42\harrowlength
\commdiag{&R^m\cr &\arrow(-1,-1)\lft{\bf B}\quad \arrow(1,-1)\rt{\bf G}\cr
R^n&\mapright^{\bf P}&R^n\cr
\mapdown\lft{e^{{\bf A}t}}&&\mapdown\rt{e^{{\bf F}t}}\cr
R^n&\mapright^{\bf P}&R^n\cr
&\arrow(1,-1)\lft{\bf C}\quad \arrow(-1,-1)\rt{\bf H}\cr
&R^q\cr}$$
Other commutative diagram examples appear in the file
`commdiags.tex', which is distributed with this package.
In these examples the arrow lengths and line slopes were carefully
chosen to blend with each other. In the first example, the default
settings for the arrow lengths are used, but a direction for the arrow
must be chosen. The ratio of the default horizontal and vertical arrow
lengths is approximately the golden mean gamma=1.618...; the arrow
direction closest to this mean is `(3,2)'. In the second example, a
slope of -1/3 is desired and the default horizontal arrow length is 60
pt; therefore, choose a vertical arrow length of 20 pt. You may affect
the interline glue settings of `\commdiag' by redefining the macro
`\commdiagbaselines'. (cf. Exercise 18.46 of `The TeXbook' and the
section on parameters below.)
The width, height, and depth of all morphisms are hidden so that the
morphisms' size do not affect arrow positions. This can cause a large
morphism at the top or bottom of a diagram to impinge upon the text
surrounding the diagram. To overcome this problem, use TeX's
`\noalign' primitive to insert a `\vskip' immediately above or below
the offending line, e.g.,
`$$\commdiag{\noalign{\vskip6pt}X&\mapright^\int&Y\cr ...}'.
The macro `\commdiag' is too simple to be used for more complicated
diagrams, which may have intersecting or overlapping arrows. A second
approach, borrowed from Francis Borceux's `Diagram' macros for LaTeX,
treats the commutative diagram like a grid of identically shaped boxes.
To compose the commutative diagram, first draw an equally spaced grid,
e.g.,
. . . . . .
. . . . . .
. . . . . .
. . . . . .
on a piece of scratch paper. Then draw each element (vertices and
arrows) of the commutative diagram on this grid, centered at each grid
point. Finally, use the macro `\gridcommdiag' to implement your design
as a TeX alignment. For example, the cubic diagram
(A commutative diagram appears here.)
that appears in Francis Borceux's documentation can be implemented on
a 7 by 7 grid, and is achieved with the code
$$\harrowlength=48pt \varrowlength=48pt \sarrowlength=20pt
\def\cross#1#2{\setbox0=\hbox{$#1$}%
\hbox to\wd0{\hss\hbox{$#2$}\hss}\llap{\unhbox0}}
\gridcommdiag{&&B&&\mapright^b&&D\cr
&\arrow(1,1)\lft a&&&&\arrow(1,1)\lft d\cr
A&&\cross{\hmorphposn=12pt\mapright^c}{\vmorphposn=-12pt\mapdown\lft f}
&&C&&\mapdown\rt h\cr\cr
\mapdown\lft e&&F&&\cross{\hmorphposn=-12pt\mapright_j}
{\vmorphposn=12pt\mapdown\rt g}&&H\cr
&\arrow(1,1)\lft i&&&&\arrow(1,1)\rt l\cr
E&&\mapright_k&&G\cr}$$
The dimensions `\hgrid' and `\vgrid' control the horizontal and
vertical spacing of the grid used by `\gridcommdiag'. The default
setting for both of these dimensions is 15 pt. Note that in the
example of the cube the arrow lengths must be adjusted so that the
arrows overlap into neighboring boxes by the desired amount. Hence,
the `\gridcommdiag' method, albeit more powerful, is less automatic
than the simpler `\commdiag' method. Furthermore, the ad hoc macro
`\cross' is introduced to allow the effect of overlapping arrows.
Finally, note that the positions of four of the morphisms are adjusted
by setting `\hmorphposn' and `\vmorphposn'.
One is not restricted to a square grid. For example, the proof of
Zassenhaus's Butterfly Lemma can be illustrated by the diagram
(appearing in Lang's book `Algebra')
(A commutative diagram appears here.)
This diagram may be implemented on a 9 by 12 grid with an aspect ratio
of 1/2, and is set with the code
$$\hgrid=16pt \vgrid=8pt \sarrowlength=32pt
\def\cross#1#2{\setbox0=\hbox{$#1$}%
\hbox to\wd0{\hss\hbox{$#2$}\hss}\llap{\unhbox0}}
\def\l#1{\llap{$#1$\hskip.5em}}
\def\r#1{\rlap{\hskip.5em$#1$}}
\gridcommdiag{&&U&&&&V\cr &&\bullet&&&&\bullet\cr
&&\sarrowlength=16pt\sline(0,1)&&&&\sarrowlength=16pt\sline(0,1)\cr
&&\l{u(U\cap V)}\bullet&&&&\bullet\r{(U\cap V)v}\cr
&&&\sline(2,-1)&&\sline(2,1)\cr
&&\cross{=}{\sline(0,1)}&&\bullet&&\cross{=}{\sline(0,1)}\cr\cr
&&\l{^{\textstyle u(U\cap v)}}\bullet&&\cross{=}{\sline(0,1)}&&
\bullet\r{^{\textstyle(u\cap V)v}}\cr
&\sline(2,1)&&\sline(2,-1)&&\sline(2,1)&&\sline(2,-1)\cr
\l{u}\bullet&&&&\bullet&&&&\bullet\r{v}\cr
&\sline(2,-1)&&\sline(2,1)&&\sline(2,-1)&&\sline(2,1)\cr
&&\bullet&&&&\bullet\cr &&u\cap V&&&&U\cap v\cr}$$
Again, the construction of this diagram requires careful choices for
the arrow lengths and is facilitated by the introduction of the ad hoc
macros `\cross', `\r', and `\l'. Note also that superscripts were used
to adjust the position of the vertices u(U intersection v) and (u
intersection V)v. Many diagrams may be typeset with the predefined
macros that appear here; however, ingenuity is often required to handle
special cases.
File: eplain.info, Node: Commutative diagram parameters, Prev: Construction of commutative diagrams, Up: Commutative diagrams
Commutative diagram parameters
------------------------------
The following is a list describing the parameters used in the
commutative diagram macros. These dimensions may be changed globally or
locally.
`\harrowlength'
(Default: 60 pt) The length of right or left arrows.
`\varrowlength'
(Default: 0.618`\harrowlength') The length of up or down arrows.
`\sarrowlength'
(Default: 60 pt) The horizontal length of slanted arrows.
`\hmorphposn'
(Default: 0 pt) The horizontal position of the morphism with
respect to its default position. There are also the dimensions
`\hmorphposnup', `\hmorphposndn', `\hmorphposnrt', and
`\hmorphposnlft' for `^'/`_' or `\lft'/`\rt' constructions.
`\vmorphposn'
(Default: 0 pt) The vertical position of the morphism with respect
to its default position. There are also the dimensions
`\vmorphposnup', `\vmorphposndn', `\vmorphposnrt', and
`\vmorphposnlft' for `^'/`_' or `\lft'/`\rt' constructions.
`\morphdist'
(Default: 4 pt) The distance of morphisms from slanted lines or
arrows.
`\channelwidth'
(Default: 3 pt) The distance between double lines or arrows.
`\hchannel, \vchannel'
(Defaults: 0 pt) Overrides `\channelwidth'. The horizontal and
vertical shifts between double lines or arrows.
`\commdiagbaselines'
(Default: `\baselineskip=15pt \lineskip=3pt \lineskiplimit=3pt ')
The parameters used by `\commdiag' for setting interline glue.
`\hgrid'
(Default: 15 pt) The horizontal spacing of the grid used by
`\gridcommdiag'.
`\vgrid'
(Default: 15 pt) The vertical spacing of the grid used by
`\gridcommdiag'.
File: eplain.info, Node: Programming definitions, Next: Copying, Prev: Arrow theoretic diagrams, Up: Top
Programming definitions
***********************
The definitions in this section are only likely to be useful when you
are writing nontrivial macros, not when writing a document.
* Menu:
* Category codes:: Changing category codes.
* Allocation macros:: Non-outer versions of \newcount et al.
* Iteration:: Doing `for' loops in TeX.
* Macro arguments:: Reading and ignoring them.
* Converting to characters:: Normalizing control sequences and spaces.
* Expansion:: Controlling expansion.
* Obeying spaces:: Making whitespace count anywhere.
* Writing out numbers:: Making `1' into `one'.
* Mode-specific penalties::
* Auxiliary files:: Testing for their existence.
File: eplain.info, Node: Category codes, Next: Allocation macros, Up: Programming definitions
Category codes
==============
Plain TeX defines `\active' (as the number 13) for use in changing
category codes. Although the author of `The TeXbook' has
"intentionally kept the category codes numeric", two other categories
are commonly used: letters (category code 11) and others (12).
Therefore, Eplain defines `\letter' and `\other'.
Sometimes it is cleaner to make a character active without actually
writing a `\catcode' command. The `\makeactive' command takes a
character as an argument to make active (and ignores following spaces).
For example, here are two commands which both make `\' active:
\makeactive`\\ \makeactive92
Usually, when you give a definition to an active character, you have
to do so inside a group where you temporarily make the character active,
and then give it a global definition (cf. the definition of
`\obeyspaces' in `The TeXbook'). This is inconvenient if you are
writing a long macro, or if the character already has a global
definition you do not wish to transcend. Eplain provides `\letreturn',
which defines the usual end-of-line character to be the argument. For
example:
\def\mymacro{... \letreturn\myreturn ... }
\mymacro hello
there
The end-of-line between `hello' and `there' causes `\myreturn' to be
expanded.
`The TeXbook' describes `\uncatcodespecials', which makes all
characters which are normally "special" into "other" characters, but
the definition never made it into plain TeX. Eplain therefore defines
Finally, `\percentchar' expands into a literal `%' character. This
is useful when you `\write' TeX output to a file, and want to avoid
spurious spaces. For example, Eplain writes a `\percentchar' after the
definition of cross-references. The macros `\lbracechar' and
`\rbracechar' expand similarly.